<template>
  <div id="Head">
    <el-row>
      <el-col :span="3">
        <div class="grid-content bg-purple">后台管理</div>
      </el-col>
      <el-col :span="15">
        <div class="grid-content bg-purple-light"></div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content bg-purple" style="float:right">
          <el-dropdown>
                <span class="el-dropdown-link">
                个人中心
                <el-icon class="el-icon--right">
                    <ArrowDown/>
                </el-icon>
                </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item>个人信息</el-dropdown-item>
                <el-dropdown-item divided @click="logout">退出系统</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import request from '../utils/request'
import {ArrowDown} from '@element-plus/icons'
export default {
  name: 'Head',

  components:{
    ArrowDown
  },

  methods: {
    logout() {
      request.post("/user/logout").then(res=>{
       if(res.code === 0){
          sessionStorage.removeItem("user")
          sessionStorage.removeItem("token")
           this.$router.push('/login')
       }
      })
    }
  }
}
</script>

<style lang="less" scoped>
@import "../style/admin/head.less";
</style>
